<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>

<sec:authentication property="principal" var="currentPrincipal" scope="page" />

<sec:authentication property="principal" var="currentPrincipal" scope="page" />

<div class="modal-dialog x-modal-dialog" style="width: 600px;">

  <div class="modal-content">

    <div class="modal-header x-breadcrumb clearfix">

      <h2><i class="glyphicon glyphicon-fire" title=""></i>&nbsp;&nbsp;<span>课程表过滤</span></h2>

      <button type="button" class="close" data-dismiss="modal">&times;</button>

    </div>

    <form class="form-horizontal" method="GET" action="${ctx.host}/schedules">

      <input type="hidden" name="coachview" value="${param.coachview}" >

      <div class="modal-body">

        <div class="form-group x-form-group">
          
          <label class="col-xs-3 control-label">开始日期</label>
          <div class="col-xs-7" style="width: 60%;">
            <input type="text" class="form-control date" name="beginDate" value="${param.beginDate}" />
          </div>
        </div>
        
        <div class="form-group x-form-group">
          <label class="col-xs-3 control-label">周数</label>
          <div class="col-xs-7" style="width: 60%;">
            <select name="weekOffset" class="form-control select2">
              <option></option>
              <option value="1" ${1 eq param.weekOffset ? 'selected' : ''}>一周</option>
              <option value="2" ${2 eq param.weekOffset ? 'selected' : ''}>二周</option>
              <option value="3" ${3 eq param.weekOffset ? 'selected' : ''}>三周</option>
              <option value="4" ${4 eq param.weekOffset ? 'selected' : ''}>四周</option>
              <option value="5" ${5 eq param.weekOffset ? 'selected' : ''}>五周</option>
              <option value="6" ${6 eq param.weekOffset ? 'selected' : ''}>六周</option>
              <option value="7" ${7 eq param.weekOffset ? 'selected' : ''}>七周</option>
              <option value="8" ${8 eq param.weekOffset ? 'selected' : ''}>八周</option>
            </select>
          </div>

        </div>
        
        <div class="form-group x-form-group">
          <label class="col-xs-3 control-label">教练</label>
          <div class="col-xs-7" style="width: 60%;">
            <select name="coachId" class="form-control select2">
              <option></option>
              <c:forEach var="principal" items="${persist.coaches(currentPrincipal.id, param.site)}">
                  <option value="${principal.key}" ${principal.key eq param.coachId ? 'selected' : ''}>${principal.value.name}</option>
              </c:forEach>
            </select>
          </div>
        </div>
        
      </div>

      <div class="modal-footer">
        <button type="submit" class="btn btn-success btn-shadow btn-shadow-success x-btn">查询</button>&nbsp;&nbsp;&nbsp;&nbsp;
        <button type="button" class="btn btn-default btn-shadow btn-shadow-default x-btn" data-dismiss="modal">取消</button>
      </div>

    </form>

  </div>

</div>

<script type="text/javascript">
  $(function() {
    
    $('.date').datetimepicker({
      format: 'yyyy-mm-dd',
      autoclose: true,
      language: 'zh-CN',
      todayBtn: 'linked',
      todayHighlight: true,
      pickerPosition: 'bottom-right',
      minView: 'month'
    })
    
    $('.select2').select2({
      minimumResultsForSearch : -1,
      allowClear : true,
      width: '100%'
     });
  })
</script>
